import 'package:xuance/bean/MidChartbean.dart';
import 'package:xuance/bean/PieDataBean.dart';
import 'package:xuance/bean/SnortBean.dart';
import 'package:xuance/network/network_service.dart';

class SnortApi {
  static Future<List<MidChartbean>> midData(
      startDate, endDate, queryCondition) async {
    var res = await NetworkService.post(
        url: "events-detail/queryWarningLevel",
        map: {
          "startDate": startDate,
          "endDate": endDate,
          "queryCondition": queryCondition,
        },
        showErrToast: false,
        isShowLoading: false);
    return res.getTypedList((m) => MidChartbean.fromJson(m)) ?? [];
  }

  static Future<List<SnortDataBean>> getSnortData(
      {required String startTime,
      required String endTime,
      required String queryCondition}) async {
    var res = await NetworkService.post(
        url: "events-detail/queryWarningFeature",
        map: {
          "startDate": startTime,
          "endDate": endTime,
          "queryCondition": queryCondition
        },
        isShowLoading: false);
    return res.getTypedList((m) => SnortDataBean.fromJson(m)) ?? [];
  }

  static Future<SnortBean?> getList(
      String startDate, String endDate, int currentPage, queryCondition) async {
    var res = await NetworkService.post(
        url: "base-model-forecast-prd/queryBaseModelForecastPrdDpList",
        map: {
          "startDate": startDate,
          "endDate": endDate,
          "pageSize": 10,
          "currentPage": currentPage,
          "queryCondition": queryCondition,
        },
        showErrToast: false);
    return res.getTypedData((m) => SnortBean.fromJson(m));
  }
}
